package cn.ygh.bbo.framerwork.web.editor;

import org.apache.commons.lang3.StringUtils;

import java.beans.PropertyEditorSupport;
import java.math.BigDecimal;

/**
 * @author ygh
 * @Desc BigDecimal类型转换
 * @date 2019/10/28
 */
public class BigDecimalPropertyEditorSupport extends PropertyEditorSupport {
    @Override
    public void setAsText(String text) throws IllegalArgumentException {
        if (StringUtils.isBlank(text)) {
            setValue(null);
        } else {
            setValue(new BigDecimal(text));
        }
    }
}
